<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<%@ include file="../common/top_css.jsp"%>
    <link href="${pageContext.request.contextPath}/bootstrap/calendar/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="${pageContext.request.contextPath}/bootstrap/calendar/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">

	<script type="text/javascript" src="${pageContext.request.contextPath}/bootstrap/js/jquery-1.8.3.js" charset="UTF-8"></script>
	
	<script type="text/javascript" src="${pageContext.request.contextPath}/bootstrap/calendar/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/bootstrap/calendar/js/locales/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script>
	<script type="text/javascript">
	$(function(){
			$.ajax({
				url : "${pageContext.request.contextPath}/supplier/selectSupplierList.action",
				type : "POST",
				dataType : "json", 
				data : {},
				success : function(result, start, resp) {
					var str='';
					for ( var i = 0; i < result.length; i++) {
						str+='<option value="'+result[i].uuid+'">'+result[i].name+'</option>';
					}
					$("#selectID").append(str);
				}
			});
			$.ajax({
				url : "${pageContext.request.contextPath}/order/selectOrderList.action",
				type : "POST",
				dataType : "json", 
				data : {},
				success : function(result, start, resp) {
					var str='';
					for ( var i = 0; i < result.length; i++) {
						if(result[i].completer.name==null){
							str+='<tr><td>'
							+result[i].orderTypeView+'</td><td>'
							+result[i].creater.name+'</td><td>'
							+result[i].checker.name+'</td><td>'
							+result[i].supplier.name+'</td><td>'
							+result[i].createTimeView+'</td><td>'
							+result[i].checkTimeView+'</td><td>'
							+result[i].supplier.needsView+'</td><td><a href="${pageContext.request.contextPath}/order/selectOrderDeteil4.action?uuid='
							+result[i].uuid+'">任务指派</a></td></tr>';
						}else{
							str+='<tr><td>'
							+result[i].orderTypeView+'</td><td>'
							+result[i].creater.name+'</td><td>'
							+result[i].checker.name+'</td><td>'
							+result[i].supplier.name+'</td><td>'
							+result[i].createTimeView+'</td><td>'
							+result[i].checkTimeView+'</td><td>'
							+result[i].supplier.needsView+'</td><td>'
							+result[i].completer.name+'</td></tr>';
						}
					}
					$("#tables").append(str);
				}
			});
		
			$("#search").click(function(){
				var supplieruuid=$("select[name='supplieruuid']").val();
				var creatername=$("input[name='creater.name']").val();
				var supplierneeds=$("select[name='supplier.needs']").val();
				var completername=$("input[name='completer.name']").val();
				var checkername=$("input[name='checker.name']").val();
				var createTimeViewMin=$("input[name='createTimeMin']").val();
				var createTimeViewMax=$("input[name='createTimeMax']").val();
				var checkTimeViewMin=$("input[name='checkTimeMin']").val();
				var checkTimeViewMax=$("input[name='checkTimeMax']").val();
				$.ajax({
					url : "${pageContext.request.contextPath}/order/selectOrderList.action",
					type : "POST",
					dataType : "json", 
					data : {"supplieruuid":supplieruuid,
							"creater.name":creatername,
							"supplier.needs":supplierneeds,
							"completer.name":completername,
							"checker.name":checkername,
							"createTimeViewMin":createTimeViewMin,
							"createTimeViewMax":createTimeViewMax,
							"checkTimeViewMin":checkTimeViewMin,
							"checkTimeViewMax":checkTimeViewMax},
					success : function(result, start, resp) {
						var str='';
						for ( var i = 0; i < result.length; i++) {
							if(result[i].completer.name==null){
								str+='<tr><td>'
								+result[i].orderTypeView+'</td><td>'
								+result[i].creater.name+'</td><td>'
								+result[i].checker.name+'</td><td>'
								+result[i].supplier.name+'</td><td>'
								+result[i].createTimeView+'</td><td>'
								+result[i].checkTimeView+'</td><td>'
								+result[i].supplier.needsView+'</td><td><a href="${pageContext.request.contextPath}/order/selectOrderDeteil4.action?uuid='
								+result[i].uuid+'">任务指派</a></td></tr>';
							}else{
								str+='<tr><td>'
								+result[i].orderTypeView+'</td><td>'
								+result[i].creater.name+'</td><td>'
								+result[i].checker.name+'</td><td>'
								+result[i].supplier.name+'</td><td>'
								+result[i].createTimeView+'</td><td>'
								+result[i].checkTimeView+'</td><td>'
								+result[i].supplier.needsView+'</td><td>'
								+result[i].completer.name+'</td></tr>';
							}
						}
						$("#tdAdd").empty();
						$("#tables").append(str);
					}
				}); 
			});
        $(".form_datetime").datetimepicker({format: 'yyyy-mm-dd hh:ii',minView:1});
		$(".form_date").datetimepicker({format: 'yyyy-mm-dd',minView:3,todayBtn:true,todayHighlight:true }); 
		       
	 
	});

</script>

</head>

<body>
	<div class="navbar navbar-fixed-top bs-docs-nav" role="banner">
		<div class="conjtainer">
  			<%@ include file="../common/top_nav.jsp" %>
		</div>
	</div>

	<%@ include file="../common/top.jsp" %>
	<div class="content">
		<%@ include file="../common/left.jsp" %>
		<div class="mainbar">
		<%@ include file="../common/page-head.jsp" %>
			<div class="matter">
				<div class="container">
				<!-- 内容开始 -->
					<!-- 表单 -->
					<div class="widget wgreen">
		                <div class="widget-head">
		                  <div class="pull-left">搜索</div>
		                  <div class="widget-icons pull-right">
		                    <a href="#" class="wminimize"><i class="icon-chevron-up"></i></a> 
		                    <a href="#" class="wclose"><i class="icon-remove"></i></a>
		                  </div>
		                  <div class="clearfix"></div>
		                </div>
		                <div class="widget-content">
		                  <div class="padd">
		                    <!-- Form starts.  -->
		                     <form class="form-horizontal" role="form">
		                              
		                                <div class="form-group">
		                                  <label class="col-lg-2 control-label">供应商</label>
		                                  <div class="col-lg-4">
		                                    <select class="form-control" name="supplieruuid" id="selectID">
		                                      <option value="">--请选择--</option>
		                                    </select>
		                                  </div>
		                                </div>
		                                 <div class="form-group">
		                                 <label class="col-lg-2 control-label">下单人</label>
		                                  <div class="col-lg-4">
		                                    <input class="form-control" name="creater.name" placeholder="下单人" type="text">
		                                  </div>
		                                  <label class="col-lg-2 control-label">发货方式</label>
		                                  <div class="col-lg-4">
		                                    <select class="form-control" name="supplier.needs">
		                                      <option value="">--请选择--</option>
		                                      <option value="1">送货</option>
		                                      <option value="2">自提</option>
		                                    </select>
		                                  </div>
		                                </div>
		                                
		                                <div class="form-group">
		                                  <label class="col-lg-2 control-label">跟单人</label>
		                                  <div class="col-lg-4">
		                                    <input class="form-control" name="completer.name" placeholder="跟单人" type="text">
		                                  </div>
		                                  <label class="col-lg-2 control-label">审核人</label>
		                                  <div class="col-lg-4">
		                                    <input class="form-control" name="checker.name" placeholder="审核人" type="text">
		                                  </div>
		                                </div>
		                                <div class="form-group">
		                                  <label class="col-lg-2 control-label">下单时间</label>
		                                  <div class="col-lg-4">
		                                    <input class="form_date form-control" name="createTimeMin" placeholder="年-月-日"  type="text">
		                                  </div>
		                                  <label class="col-lg-2 control-label">到</label>
		                                  <div class="col-lg-4">
		                                    <input class="form_date form-control" name="createTimeMax" placeholder="年-月-日" type="text">
		                                  </div>
		                                </div> 
		                                
		                                <div class="form-group">
		                                  <label class="col-lg-2 control-label">审核时间</label>
		                                  <div class="col-lg-4">
		                                    <input class="form_date form-control" name="checkTimeMin" placeholder="年-月-日"  type="text">
		                                  </div>
		                                  <label class="col-lg-2 control-label">到</label>
		                                  <div class="col-lg-4">
		                                    <input class="form_date form-control" name="checkTimeMax" placeholder="年-月-日" type="text">
		                                  </div>
		                                </div> 
		                                <hr>
		                                <div class="form-group">
		                                  <div class="col-lg-offset-1 col-lg-9">
		                                    <button type="button" id="search" class="btn btn-success">Search</button>
		                                  </div>
		                                </div>
		                              </form>
		                  </div>
		                </div>
		                  <div class="widget-foot">
		                    <!-- Footer goes here -->
		                  </div>
		              </div>	
					<!-- 表格 -->
					<div class="widget">
		                <div class="widget-head">
		                  <div class="pull-left">供应商列表</div>
		                  <div class="widget-icons pull-right">
		                    <a href="#" class="wminimize"><i class="icon-chevron-up"></i></a> 
		                    <a href="#" class="wclose"><i class="icon-remove"></i></a>
		                  </div>  
		                  <div class="clearfix"></div>
		                </div>
		                <div class="widget-content">
			                <table class="table table-striped table-bordered table-hover" id="tables">
			                      <thead>
			                        <tr>
			                          <th>订单类型</th>
			                          <th>制单人</th>
			                          <th>审核人</th>
			                          <th>供应商</th>
			                          <th>制单时间</th>
			                          <th>审核时间</th>
			                          <th>发货方式</th>
			                          <th>跟单人</th>
			                        </tr>
			                      </thead>
			                      <tbody id="tdAdd">
			                      </tbody>
			                    </table>
		                    <div class="widget-foot">
		                        <ul class="pagination pull-right">
		                          <li><a href="#">Prev</a></li>
		                          <li><a href="#">1</a></li>
		                          <li><a href="#">2</a></li>
		                          <li><a href="#">3</a></li>
		                          <li><a href="#">4</a></li>
		                          <li><a href="#">Next</a></li>
		                        </ul>
		                      <div class="clearfix"></div> 
		                    </div>
		
		                </div>
		
	                </div>
				
				
				<!-- 内容结束 -->
				</div>
			</div>
		</div>
	</div>
	<%@ include file="../common/footer.jsp" %>
 	<%@ include file="../common/footer_js.jsp" %>
 
             
</body>
</html>
